﻿using HCQ2_Common;
using HCQ2_Common.Constant;
using HCQ2_Model;
using HCQ2_Model.APIBase;
using HCQ2_Model.ViewModel.WebAPI;
using HCQ2_Model.VLine.InputDto._0410;
using HCQ2_Model.VLine.InputDto._0416;
using HCQ2_Model.VLine.InputDto._20220219;
using HCQ2_Model.VLine.OutputDto;
using HCQ2_Model.VLine.OutputDto._0416;
using HCQ2_Model.VLine.OutputDto._20220219;
using HCQ2_Model.VLine.Params;
using HCQ2_Model.VRDD.InputDto._20220620;
using HCQ2_Model.VRDD.InputDto._20220627;
using HCQ2_Model.VRDD.OutputDto._20220620;
using HCQ2_Model.VRDD.OutputDto._20220627;
using HCQ2UI_Helper.Session;
using HCQ2WebAPI_Logic.BaseAPIController;
using HCQ2WebAPI_Logic.Filters;
using HCQ2WebAPI_Logic.Model;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Web.Http;

namespace HCQ2WebAPI_Logic.DocumentController
{
    /// <summary>
    ///  VR度度圈GetAreainfo
    /// </summary>
    public class VRDDCircleController : BaseWeiXinApiLogic
    {
        //****************************************************2021-04-10需求*******************************************************
        #region 0.0 保存关联商品 + WebApiResultJsonModel SaveRelGood(DDCircleInput model)
        /// <summary>
        ///  保存关联商品
        /// </summary>
        /// <param name="model">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel SaveRelGood(DDCircleInput model)
        {
            //1.0 验证数据有效性
            T_User user = operateContext.bllSession.T_User.FindSingle(s => s.user_guid.Equals(model.userid));
            if (user == null)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "用户信息有误！", null);
            int mark = operateContext.bllSession.T_DocumentInfo.SelectCount(s => s.file_id == model.file_id && s.file_status == 5);
            if (mark <= 0)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "度度圈商品id已下架或不存在！", null);
            if (model.obj == null || model.obj.Count <= 0)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "关联商品不允许空！", null);
            List<DDCircleRelFile> file = new List<DDCircleRelFile>();
            foreach (var item in model.obj)
            {
                var q = operateContext.bllSession.T_DocumentInfo.FindSingle(o => o.file_id == item.rel_id && o.file_status == 5);
                if (q == null)
                    return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, $"关联商品【id={item.rel_id}】已下架或不存在！", null);
                //判断是否已关联
                int m = operateContext.bllSession.T_VRDDCircleRelGood.SelectCount(s => s.rel_id == q.file_id && s.dd_id == model.file_id);
                if (m <= 0)
                {
                    string mater_type = q.mater_type;
                    if (q.mater_type.Equals("IMAGE"))
                        mater_type = "image";
                    else if (q.mater_type.Equals("VIDEO"))
                        mater_type = "video";
                    if (q.page_type.Equals("VRWorks"))
                        mater_type = "works";
                    file.Add(new DDCircleRelFile { rel_id = q.file_id, mater_type = mater_type.ToLower() });
                }
            }
            //2.0 保存关联数据
            file.ForEach(s =>
            {
                int m = operateContext.bllSession.T_VRDDCircleRelGood.SelectCount(o => o.dd_id == model.file_id && o.rel_id == s.rel_id);
                if (m <= 0)
                {
                    operateContext.bllSession.T_VRDDCircleRelGood.Add(new T_VRDDCircleRelGood
                    {
                        dd_id = model.file_id,
                        rel_id = s.rel_id,
                        rel_type = s.mater_type,
                        create_id = user.user_id,
                        create_name = user.user_name,
                        create_date = DateTime.Now,
                        update_id = user.user_id,
                        update_name = user.user_name,
                        update_date = DateTime.Now
                    });
                }
            });
            return ApiResultJsonModel.RedirectWebApi(WebResultCode.Ok, "关联商品保存成功~", "");
        }
        #endregion

        #region 1.0 移除关联商品 + WebApiResultJsonModel RemoveRelGood(DDCircleInput model)
        /// <summary>
        ///  移除关联商品
        /// </summary>
        /// <param name="model">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel RemoveRelGood(DDCircleInput model)
        {
            //1.0 验证数据有效性
            if (model.file_id <= 0)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "待移除的商品不存在！", null);
            if (model.obj == null || model.obj.Count <= 0)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "待移除的关联商品不存在！", null);
            model.obj.ForEach(s => operateContext.bllSession.T_VRDDCircleRelGood.Delete(o => o.dd_id == model.file_id && o.rel_id == s.rel_id));
            return ApiResultJsonModel.RedirectWebApi(WebResultCode.Ok, "成功移除关联商品~", "");
        }
        #endregion

        #region 1.1 获取行政区域信息+ WebApiResultJsonModel GetAreainfo(AreaParam param)
        /// <summary>
        ///  获取行政区域信息
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        /// <remarks>禅道20220622- 344优化</remarks>
        [HttpPost]
        public WebApiResultJsonModel<List<OutputAreainfoPid>> GetAreainfo(AreaParam param)
        {
            if (param.id < 0)
                return ApiResultJsonModel<List<OutputAreainfoPid>>.RedirectWebApi(WebResultCode.Exception, "请传区域id", null);
            List<OutputAreainfoPid> result = new List<OutputAreainfoPid>();
            var list = operateContext.bllSession.T_VRAreaInfo.Select(s => s.area_pid == param.id, s => s.jpSign);
            list?.ForEach(s =>
            {
                var temp = Helper.AutoMapperConvert<OutputAreainfoPid, T_VRAreaInfo>(s);
                temp.area_letter = temp.jpSign.Substring(0, 1).ToUpper();
                result.Add(temp);
            });
            return ApiResultJsonModel<List<OutputAreainfoPid>>.RedirectWebApi(WebResultCode.Ok, "", result);
        }
        #endregion

        //****************************************************2021-04-16需求*******************************************************
        #region 2.0 保存和编辑商品折扣 + WebApiResultJsonModel SaveReducedRate(GoodRate model)
        /// <summary>
        ///  保存和编辑商品折扣
        /// </summary>
        /// <param name="model">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel SaveReducedRate(GoodRate model)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            //获取操作用户
            var user = operateContext.bllSession.T_User.FindSingle(s => s.user_guid.Equals(model.userid));
            if (user == null)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "当前操作用户数据异常！", null);
            var folder = operateContext.bllSession.T_DocumentFolder.SelectCount(s => s.folder_id == model.store_id && !s.if_remove);
            if (folder <= 0)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "后台查无此商铺！", null);
            var mark = operateContext.bllSession.T_DocumentInfo.FindSingle(s => s.file_id == model.file_id && s.file_status == 5 && !s.if_remove);
            if (mark == null)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "当前商品file_id后台已下架或不存在！", null);
            if (model.rateList.Count <= 0)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "当折扣明细为必传项！", null);
            var obj = operateContext.bllSession.T_VRGoodDiscount.Select(s => s.file_code.Equals(mark.file_code) && s.user_id == user.user_id && s.store_id == model.store_id);
            model.rateList.ForEach(s =>
            {
                var temp = obj?.Where(o => o.user_level == s.user_level)?.FirstOrDefault();
                if (temp != null)
                {
                    //编辑
                    operateContext.bllSession.T_VRGoodDiscount.Modify(new T_VRGoodDiscount
                    {
                        user_level = s.user_level,
                        rate = s.rate,
                        note = s.note,
                        update_id = user.user_id,
                        update_name = user.user_name,
                        update_date = DateTime.Now
                    }, o => o.id == temp.id, "user_level", "rate", "note", "update_id", "update_name", "update_date");
                }
                else
                {
                    //添加
                    operateContext.bllSession.T_VRGoodDiscount.Add(new T_VRGoodDiscount
                    {
                        file_id = model.file_id,
                        file_name = mark.file_name,
                        file_code = mark.file_code,
                        user_level = s.user_level,
                        rate = s.rate,
                        note = s.note,
                        user_id = user.user_id,
                        store_id = model.store_id,
                        create_id = user.user_id,
                        create_name = user.user_name,
                        create_date = DateTime.Now,
                        update_id = user.user_id,
                        update_name = user.user_name,
                        update_date = DateTime.Now
                    });
                }
            });
            //删除被取消的记录
            obj?.ForEach(s =>
            {
                var n = model.rateList.Where(o => o.user_level == s.user_level && o.rate > 0);
                if (n == null || n.Count() <= 0)
                    operateContext.bllSession.T_VRGoodDiscount.Delete(m => m.id == s.id);
            });
            return ApiResultJsonModel.RedirectWebApi(WebResultCode.Ok, "操作成功~", "");
        }
        #endregion

        #region 2.1 获取商品折扣信息+ WebApiResultJsonModel<List<GoodRateResult>> GetReducedRate(GoodRatePram param)
        /// <summary>
        ///  获取商品折扣信息
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<GoodRateResult>> GetReducedRate(GoodRatePram param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<List<GoodRateResult>>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            if (param.file_id > 0)
            {
                int mark = operateContext.bllSession.T_DocumentInfo.SelectCount(p => p.file_id == param.file_id);
                if (mark <= 0)
                    return ApiResultJsonModel<List<GoodRateResult>>.RedirectWebApi(WebResultCode.Exception, "当前商品后台不存在！", null);
            }
            var list = operateContext.bllSession.T_VRGoodDiscount.GetReducedRate(param);
            return ApiResultJsonModel<List<GoodRateResult>>.RedirectWebApi(WebResultCode.Ok, "", list);
        }
        #endregion

        #region 2.2 获取创始商铺信息+ WebApiResultJsonModel<List<GoodRateResult>> GetFolderInfo(FolderInfoParam param)
        /// <summary>
        ///  获取创始商铺信息
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<FolderInfoResult>> GetFolderInfo(FolderInfoParam param)
        {
            //1.0 验证数据有效性
            if (string.IsNullOrEmpty(param.userid) && param.folder_id <= 0)
                return ApiResultJsonModel<List<FolderInfoResult>>.RedirectWebApi(WebResultCode.Exception, "userid和folder_id不能同时为空！", null);
            if (!string.IsNullOrEmpty(param.userid))
                param.user_id = SysPermissSession.ChangeIdByGuid(param.userid);//用户id
            var list = operateContext.bllSession.T_VRGoodDiscount.GetFolderInfo(param);
            return ApiResultJsonModel<List<FolderInfoResult>>.RedirectWebApi(WebResultCode.Ok, "", list);
        }
        #endregion

        #region 2.3 获取合伙商铺信息+ WebApiResultJsonModel<List<ApplyFolderResult>> GetPartnerFolderInfo(FolderInfoParam param)
        /// <summary>
        ///  获取合伙商铺信息
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<ApplyFolderResult>> GetPartnerFolderInfo(FolderInfoParam param)
        {
            //1.0 验证数据有效性
            if (string.IsNullOrEmpty(param.userid))
                return ApiResultJsonModel<List<ApplyFolderResult>>.RedirectWebApi(WebResultCode.Exception, "userid不能为空！", null);
            int user_id = SysPermissSession.ChangeIdByGuid(param.userid);//用户id
            if (user_id <= 0)
                return ApiResultJsonModel<List<ApplyFolderResult>>.RedirectWebApi(WebResultCode.Exception, "userid数据异常！", null);
            param.user_id = user_id;
            var list = operateContext.bllSession.T_VRGoodDiscount.GetApplyFolderInfo(param);
            return ApiResultJsonModel<List<ApplyFolderResult>>.RedirectWebApi(WebResultCode.Ok, "", list);
        }
        #endregion

        #region 2.4 获取未关联任何商品的素材列表+ WebApiResultJsonModel<List<ApplyFolderResult>> GetMaterialInfo(MaterialParam param)
        /// <summary>
        ///  获取未关联任何商品的素材列表
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<MaterialResult>> GetMaterialInfo(MaterialParam param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<List<MaterialResult>>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            var list = operateContext.bllSession.T_VRGoodDiscount.GetMaterialResult(param);
            return ApiResultJsonModel<List<MaterialResult>>.RedirectWebApi(WebResultCode.Ok, "", list);
        }
        #endregion

        #region 2.5 获取未关联的商品素材+ WebApiResultJsonModel<List<UnlinkedMaterialOutput>> GetUnlinkedMaterial(UnlinkedMaterialParam param)
        /// <summary>
        ///  获取未关联的商品素材
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<UnlinkedMaterialOutput>> GetUnlinkedMaterial(UnlinkedMaterialParam param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<List<UnlinkedMaterialOutput>>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            var list = operateContext.bllSession.T_VRGoodDiscount.GetUnlinkedMaterial(param);
            return ApiResultJsonModel<List<UnlinkedMaterialOutput>>.RedirectWebApi(WebResultCode.Ok, "", list);
        }
        #endregion


        //****************************************************2022-02-17需求*******************************************************
        #region 3.0 获取搜索关键词+ WebApiResultJsonModel<List<OutputSearchKeyword>> GetSearchKeyword(InputSearchKeyword param)
        /// <summary>
        ///  获取搜索关键词
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<OutputSearchKeyword>> GetSearchKeyword(InputSearchKeyword param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<List<OutputSearchKeyword>>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            List<OutputSearchKeyword> list = new List<OutputSearchKeyword>();
            List<T_VRDDKeyword> result = operateContext.bllSession.T_VRDDKeyword.Select(s => s.pro_type == param.proType).OrderByDescending(s => s.degree)?.ToList();
            result?.ForEach(s => list.Add(new OutputSearchKeyword { keyword = s.keyword, degree = s.degree }));
            return ApiResultJsonModel<List<OutputSearchKeyword>>.RedirectWebApi(WebResultCode.Ok, "成功获取搜索关键词！", list);
        }
        #endregion

        //****************************************************2022-02-19需求*******************************************************
        #region 4.0 更新推送消息已读状态 + WebApiResultJsonModel ModifyPushMsg(InputModifyPushMsg param)
        /// <summary>
        ///  更新推送消息已读状态
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel ModifyPushMsg(InputModifyPushMsg param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            if (param.msgUserIDList == null || param.msgUserIDList.Count <= 0)
                return ApiResultJsonModel.RedirectWebApi(WebResultCode.Exception, "用户消息主键为空！", null);
            param.msgUserIDList.ForEach(o =>
            {
                operateContext.bllSession.T_VRDDSendUser.Modify(new T_VRDDSendUser { accept_status = param.status, accept_date = DateTime.Now }, s => s.id == o.id, "accept_status", "accept_date");
            });
            return ApiResultJsonModel.RedirectWebApi(WebResultCode.Ok, "成功更新推送消息已读状态~", "");
        }
        #endregion

        #region 4.1 获取推送消息列表+ WebApiResultJsonModel<PushMsgOutput> GetPushMsgList(InputPushMsgParam param)
        /// <summary>
        ///  获取推送消息列表
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<PushMsgOutput>> GetPushMsgList(InputPushMsgParam param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<List<PushMsgOutput>>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            int user_id = SysPermissSession.ChangeIdByGuid(param.userid);
            var list = operateContext.bllSession.T_VRDDKeyword.GetPushMsgList(param, user_id);
            return ApiResultJsonModel<List<PushMsgOutput>>.RedirectWebApi(WebResultCode.Ok, "成功获取推送消息列表！", list);
        }
        #endregion

        #region 4.2 获取店铺推送消息+ WebApiResultJsonModel<PushMsgOutput> GetStorePushMsg(StorePushInput param)
        /// <summary>
        ///  获取店铺推送消息
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        [HttpPost]
        public WebApiResultJsonModel<List<StorePushOutput>> GetStorePushMsg(StorePushInput param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<List<StorePushOutput>>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            int user_id = SysPermissSession.ChangeIdByGuid(param.userid);
            var list = operateContext.bllSession.T_VRDDKeyword.GetStorePushMsg(param, user_id);
            return ApiResultJsonModel<List<StorePushOutput>>.RedirectWebApi(WebResultCode.Ok, "成功获取店铺推送消息！", list);
        }
        #endregion

        //****************************************************2022-03-25需求*******************************************************
        #region 5.0 获取好友店铺动态+自己的动态+ WebApiResultJsonModel<FriendStoreNewsOutput> GetFriendStoreNews(FriendStoreNewsInput param)
        /// <summary>
        ///  5.0 获取好友店铺动态+自己的动态+推荐
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        /// <remarks>
        /// 20220622 禅道需求 343
        /// 20220616 度度圈需求1.4
        /// </remarks>
        /// 
        [HttpPost]
        public WebApiResultJsonModel<BasePage<FriendStoreNewsOutput>> GetFriendStoreNews(FriendStoreNewsInput param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<BasePage<FriendStoreNewsOutput>>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            int user_id = SysPermissSession.ChangeIdByGuid(param.userid);
            if (user_id <= 0)
                return ApiResultJsonModel<BasePage<FriendStoreNewsOutput>>.RedirectWebApi(WebResultCode.Exception, "用户信息异常！", null);
            //获取创始人或者合伙人userid
            int owenid = SysPermissSession.ChangeIdByGuid(param.ownerID);
            var result = operateContext.bllSession.T_VRDDStoreDynamic.GetFriendStoreNews(param, user_id, owenid);
            return ApiResultJsonModel<BasePage<FriendStoreNewsOutput>>.RedirectWebApi(WebResultCode.Ok, "成功获取好友店铺动态！", result);
        }
        #endregion

        #region 5.1 保存店铺动态点赞 + WebApiResultJsonModel SaveStoreNewsStar(InputStoreNewsStar param)
        /// <summary>
        ///  5.1 保存店铺动态点赞
        /// </summary>
        /// <param name="param">参数</param>
        /// <returns></returns>
        /// <remarks>
        /// 1、20220616需求 id=【1.5】<br/>
        /// 返回：店铺动态点赞数
        /// </remarks>
        [HttpPost]
        public WebApiResultJsonModel<int?> SaveStoreNewsStar(InputStoreNewsStar param)
        {
            //1.0 验证数据有效性
            if (!ModelState.IsValid)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, getErrorMessage(ModelState), null);
            //2.1、判断用户是否存在
            int mark = SysPermissSession.ChangeIdByGuid(param.userid);
            if (mark <= 0)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, $"用户={param.userid}查无此用户编码记录！", null);
            //2.2、判断店铺动态是否存在
            var dy = operateContext.bllSession.T_VRDDStoreDynamic.FindSingle(s => s.id == param.newsID);
            if (dy == null)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, $"动态id={param.newsID}查无此店铺动态记录！", null);
            var star = operateContext.bllSession.T_VRDDUserStoreDynamicStar.FindSingle(s => s.userid.Equals(param.userid) && s.newsID == param.newsID);
            #region 点赞
            if (param.status == 1)
            {
                //点赞
                if (star != null)
                    return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, "已点赞成功~", dy.star_num);
                mark = operateContext.bllSession.T_VRDDUserStoreDynamicStar.Add(new T_VRDDUserStoreDynamicStar { userid = param.userid, newsID = param.newsID, star_date = DateTime.Now });
                if (mark > 0)
                {
                    dy.star_num = dy.star_num + 1;
                    operateContext.bllSession.T_VRDDStoreDynamic.Modify(dy, s => s.id == dy.id, "star_num");
                }
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, "点赞成功~", dy.star_num);
            }
            #endregion

            #region 取消点赞
            else
            {
                if (star == null)
                    return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "当前用户并未对此店铺动态点赞，无需取消！", dy.star_num);
                mark = operateContext.bllSession.T_VRDDUserStoreDynamicStar.Delete(s => s.id == star.id);
                if (mark > 0)
                {
                    dy.star_num = dy.star_num - 1;
                    operateContext.bllSession.T_VRDDStoreDynamic.Modify(dy, s => s.id == dy.id, "star_num");
                }
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, "点赞取消成功~", dy.star_num);
            }
            #endregion
        }
        #endregion

        #region 5.2 获取父行政区域信息 + WebApiResultJsonModel<List<OutputAreainfo>> GetAreaCdList(InputAreaInfo param)
        /// <summary>
        /// 获取父行政区域信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        /// <remarks>20220622 禅道345需求</remarks>
        [HttpPost]
        public WebApiResultJsonModel<List<OutputAreainfo>> GetAreaCdList(InputAreaInfo param)
        {
            if (param.areaID < 0)
                return ApiResultJsonModel<List<OutputAreainfo>>.RedirectWebApi(WebResultCode.Exception, "请输入正确的区域ID", null);
            List<OutputAreainfo> list = operateContext.bllSession.T_VRAreaInfo.GetAreainfo(param);
            return ApiResultJsonModel<List<OutputAreainfo>>.RedirectWebApi(WebResultCode.Ok, "", list);
        }
        #endregion

        //****************************************************2022-06-23需求*******************************************************
        #region 6.1✔获取用户积分余额 +  GetUserPointsBalance(InputGetUserPointsBalance param)
        /// <summary>
        /// 6.1 ✔获取用户积分余额
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        /// <remarks> 20220704 value需返回0</remarks>
        [HttpPost]
        [ModelValid]
        public WebApiResultJsonModel<decimal?> GetUserPointsBalance(InputGetUserPointsBalance param)
        {
            var user_id = SysPermissSession.ChangeIdByGuid(param.userid);
            if (user_id<=0)
                return ApiResultJsonModel<decimal?>.RedirectWebApi(WebResultCode.Exception, "用户编码数据异常！", null);
            decimal totalGold = 0;
            var tsm = operateContext.bllSession.T_VRTotalScoreMain.FindSingle(o => o.userid == param.userid&&o.proType==param.proType);
            if (tsm == null)
            {
                totalGold = 0;
            }
            else
            {
                totalGold = tsm.totalGold;
            }
            return ApiResultJsonModel<decimal?>.RedirectWebApi(WebResultCode.Ok, "", totalGold);
        }
        #endregion

        #region 6.2 ✔获取积分规则列表 + GetPointsRuleList(InputGetUserPointsBalance param)
        /// <summary>
        /// 6.2 ✔获取积分规则列表
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        [ModelValid]
        public WebApiResultJsonModel<List<OutputGetPointsRuleList>> GetPointsRuleList(InputGetUserPointsBalance param)
        {
            var user_id = SysPermissSession.ChangeIdByGuid(param.userid);
            if (user_id <=0)
                return ApiResultJsonModel<List<OutputGetPointsRuleList>>.RedirectWebApi(WebResultCode.Exception, "用户编码数据异常！", null);
            var list = operateContext.bllSession.T_ItemCodeMenum.GetPointsRuleList(param, user_id);
            //var qianDao = operateContext.bllSession.T_ItemCodeMenum.GetSignRewardRuleList();
            return ApiResultJsonModel<List<OutputGetPointsRuleList>>.RedirectWebApi(WebResultCode.Ok, "获取成功", list);
        }
        #endregion

        #region 6.3 ✔保存用户签到 + SaveUserSign(InputSaveUserSign param)
        /// <summary>
        /// 6.3 ✔保存用户签到
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        [ModelValid]
        public WebApiResultJsonModel<int?> SaveUserSign(InputSaveUserSign param)
        {
            var userInfo = operateContext.bllSession.T_User.FindSingle(o => o.user_guid == param.userid);
            if (userInfo == null)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "用户编码数据异常！", null);
            //var result = operateContext.bllSession.T_VRScoreSourceDetail.SaveUserSign(param, userInfo);
            //if(!result.Success)
            //    return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, result.Message, null);
            //return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, result.Message, result.Data);
            //奖励积分
            bool isJiangli = false;
            int jiangli = 0;
            int signIn = 0;
            //签到积分（数据字典PointsRule.UserSign的数量值)
            var signInInfo = operateContext.bllSession.T_ItemCodeMenum.FindSingle(o => o.code_value == "UserSign");
            if (signInInfo == null)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "未设置签到数量值", null);
            //签到积分
            signIn = Convert.ToInt32(signInInfo.numValue);
            //是否传入日期
            T_VRUserSignIn userSignIn = new T_VRUserSignIn();
            userSignIn.sigDate = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
            if (param.signDate == null)
            {
                //查询用户是否已经签到
                var isSignIn = operateContext.bllSession.T_ItemCodeMenum.GetUserSignIn(userSignIn.sigDate, userInfo.user_id, param.proType);
                if (isSignIn != null)
                {
                    return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "该用户已经签到", null);
                }
                userSignIn.userid = param.userid;
                userSignIn.createName = userInfo.user_name;
                userSignIn.createId = userInfo.user_id;
                //获取连续签到天数
                int signInDay = operateContext.bllSession.T_ItemCodeMenum.signInNum(DateTime.Now, userInfo.user_id);
                //连续签到天数
                userSignIn.sigcomDay = signInDay + 1;
                //是否已获奖励积分
                userSignIn.isRewarded = false;
                userSignIn.proType = param.proType;
                userSignIn.sigCode = Guid.NewGuid().ToString().Replace("-", "");
                //签到写入数据库
                operateContext.bllSession.T_VRUserSignIn.Add(userSignIn);
                //奖励积分1)当SignRewardRule的“条件值”=0本规则只能设置一条字典项
                var numValueInfo = operateContext.bllSession.T_ItemCode.FindSingle(o => o.item_code == "SignRewardRule");
                if (numValueInfo == null)
                {
                    return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "未设置SignRewardRule的条件值", null);
                }
                int numValue = Convert.ToInt32(numValueInfo.whereValue);
                //获取当SignRewardRule的条件值
                if (numValue == 0)
                {
                    //上次获得奖励积分的天数
                    var UserSignIn = operateContext.bllSession.T_VRUserSignIn.Select(o => o.userid == param.userid && o.isRewarded == true&&o.proType
                    ==param.proType, order => order.sigDate, false);
                    int day = 0;
                    if (UserSignIn != null && UserSignIn.Count > 0)
                    {
                        day = UserSignIn[0].sigcomDay;
                    }
                    //奖励积分
                    int wherenum = userSignIn.sigcomDay - day;
                    var piPei = operateContext.bllSession.T_ItemCodeMenum.FindSingle(o => o.code_type == wherenum.ToString() && o.code_value == "UserSign");
                    if (piPei != null)
                    {
                        jiangli = Convert.ToInt32(piPei.numValue);
                    }
                    else
                    {
                        isJiangli = false;
                    }
                }
                //2)	当SignRewardRule的“条件值”=1本规则可设置多条字典项
                else if (numValue == 1)
                {
                    //用连续签到天数匹配字典项的“条件值”，该字典项的“数量值”即为奖励积分值；
                    int wherenum = userSignIn.sigcomDay;
                    var itemid = operateContext.bllSession.T_ItemCode.FindSingle(o => o.item_code == "SignRewardRule");
                    if (itemid == null)
                    {
                        return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "字典规则异常！", null);
                    }
                    var num = operateContext.bllSession.T_ItemCodeMenum.FindSingle(o => o.code_type == wherenum.ToString() && o.item_id == itemid.item_id);
                    if (num != null)
                    {
                        jiangli = Convert.ToInt32(num.numValue);
                    }
                    else
                    {
                        //若匹配不到，则用最大的“条件值”中的“数量值”作为奖励积分值
                        jiangli = Convert.ToInt32(operateContext.bllSession.T_ItemCodeMenum.Select(o => o.item_id == itemid.item_id, order => order.code_type, false)[0].numValue);
                    }
                    isJiangli = true;
                }
                //更新是否获得奖励积分字段
                operateContext.bllSession.T_VRUserSignIn.Modify(new T_VRUserSignIn { isRewarded = isJiangli }, o => o.userid == param.userid && o.sigDate == userSignIn.sigDate&&o.proType==param.proType, "isRewarded");
            }
            else
            {
                var isSignInBu = operateContext.bllSession.T_ItemCodeMenum.GetUserSignIn(Convert.ToDateTime(param.signDate), userInfo.user_id,param.proType);
                if (isSignInBu != null)
                {
                    return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "该用户已经签到", null);
                }
                //补签

                //插入一条签到记录
                T_VRUserSignIn usi = new T_VRUserSignIn();
                usi.userid = param.userid;
                usi.createId = userInfo.user_id;
                usi.createName = userInfo.user_name;
                usi.sigcomDay = 0;
                usi.isRewarded = false;
                usi.proType = param.proType;
                usi.sigDate = Convert.ToDateTime(param.signDate);
                usi.sigCode = Guid.NewGuid().ToString().Replace("-", "");
                operateContext.bllSession.T_VRUserSignIn.Add(usi);

            }
            //  用户签到  分数既是积分
            var totalScoreInfo = operateContext.bllSession.T_VRScoreSourceMain.FindSingle(o => o.userid == param.userid && o.itemType == "UserSign"&&o.proType==param.proType);
            decimal totalScore = 0;
            //获取分数余额
            if (totalScoreInfo != null)
            {
                totalScore = totalScoreInfo.totalScore;
            }
            else
            {
                T_VRScoreSourceMain ssm = new T_VRScoreSourceMain();
                ssm.userid = param.userid;
                ssm.user_id = userInfo.user_id;
                ssm.user_name = userInfo.user_name;
                ssm.itemType = "UserSign";
                ssm.proType = param.proType;
                ssm.inScore = 0;
                ssm.outScore = 0;
                ssm.totalScore = 0;
                ssm.createDate = DateTime.Now;
                ssm.updateDate = DateTime.Now;
                ssm.logCode = Guid.NewGuid().ToString().Replace("-", "");
                operateContext.bllSession.T_VRScoreSourceMain.Add(ssm);
            }
            T_VRScoreSourceDetail ssd = new T_VRScoreSourceDetail();
            ssd.userid = param.userid;
            ssd.user_id = userInfo.user_id;
            ssd.user_name = userInfo.user_name;
            ssd.itemType = "UserSign";
            ssd.inScore = jiangli + signIn;
            ssd.outScore = 0;
            ssd.totalScore = totalScore + ssd.inScore;
            ssd.proType = param.proType;
            ssd.createDate = userSignIn.sigDate;
            ssd.logCode = Guid.NewGuid().ToString().Replace("-", "");
            //积分来源明细表 添加数据
            operateContext.bllSession.T_VRScoreSourceDetail.Add(ssd);

            //更新汇总表
            if (totalScoreInfo != null)
            {
                operateContext.bllSession.T_VRScoreSourceMain.Modify(new T_VRScoreSourceMain { totalScore = totalScoreInfo.totalScore + ssd.inScore, inScore = totalScoreInfo.inScore + ssd.inScore,updateDate=DateTime.Now }, o => o.userid == param.userid && o.itemType == "UserSign"&&o.proType==param.proType, "inScore", "totalScore", "updateDate");
            }
            else
            {
                operateContext.bllSession.T_VRScoreSourceMain.Modify(new T_VRScoreSourceMain { totalScore = ssd.inScore, inScore = ssd.inScore,updateDate=DateTime.Now }, o => o.userid == param.userid && o.itemType == "UserSign" && o.proType == param.proType, "inScore", "totalScore", "updateDate");
            }

            decimal totalGold = 0;
            var totalGoldInfo = operateContext.bllSession.T_VRTotalScoreMain.FindSingle(o => o.userid == param.userid && o.proType == param.proType);
            if (totalGoldInfo != null)
            {
                totalGold = totalGoldInfo.totalGold;

            }
            else
            {
                T_VRTotalScoreMain tsm = new T_VRTotalScoreMain();
                tsm.logCode = Guid.NewGuid().ToString().Replace("-", "");
                tsm.userid = param.userid;
                tsm.user_id = userInfo.user_id;
                tsm.user_name = userInfo.user_name;
                tsm.inGold = 0;
                tsm.outGold = 0;
                tsm.totalGold = 0;
                tsm.proType = param.proType;
                operateContext.bllSession.T_VRTotalScoreMain.Add(tsm);

            }
            T_VRTotalScoreDetail tsd = new T_VRTotalScoreDetail();
            tsd.userid = param.userid;
            tsd.user_id = userInfo.user_id;
            tsd.user_name = userInfo.user_name;
            tsd.itemType = "UserSign";
            tsd.inGold = jiangli + signIn;
            tsd.outGold = 0;
            tsd.totalGold = totalGold + tsd.inGold;
            tsd.proType = param.proType;
            tsd.createDate = userSignIn.sigDate;
            tsd.logCode = Guid.NewGuid().ToString().Replace("-", "");
            //用户积分【明细表】添加记录
            operateContext.bllSession.T_VRTotalScoreDetail.Add(tsd);

            //更新汇总表
            if (totalGoldInfo != null)
            {
                operateContext.bllSession.T_VRTotalScoreMain.Modify(new T_VRTotalScoreMain { totalGold = totalGoldInfo.totalGold + tsd.inGold, inGold = totalGoldInfo.inGold + tsd.inGold }, o => o.userid == param.userid && o.proType == param.proType, "totalGold", "inGold");
            }
            else
            {
                operateContext.bllSession.T_VRTotalScoreMain.Modify(new T_VRTotalScoreMain { totalGold = tsd.inGold, inGold = tsd.inGold }, o => o.userid == param.userid && o.proType == param.proType, "totalGold", "inGold");
            }
            //获取连续签到天数
            //查询最近签到时间
            var SignInfo = operateContext.bllSession.T_VRUserSignIn.Select(o => o.userid == param.userid&&o.proType==param.proType, order => order.sigDate, false);
            DateTime SignDate = SignInfo[0].sigDate;
            int dayNum = operateContext.bllSession.T_ItemCodeMenum.GetSignInNum(SignDate, userInfo.user_id).sigcomDay;
            return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, "签到成功", dayNum);
        }
        #endregion

        #region 6.4 ✔保存用户积分来源 + SaveUserPointsSource(InputSaveUserPointsSource param)
        /// <summary>
        /// 6.4 ✔保存用户积分来源
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        [ModelValid]
        public WebApiResultJsonModel<int?> SaveUserPointsSource(InputSaveUserPointsSource param)
        {
            var userInfo = operateContext.bllSession.T_User.FindSingle(o => o.user_guid == param.userid);
            if (userInfo == null)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "用户编码数据异常！", null);
            decimal value = 0;
            string Rx = @"^\+?(:?(:?\d+\.\d+)|(:?\d+))|(-?\d+)(\.\d+)?$";
            if (Regex.IsMatch(param.value.ToString(), Rx))
                value = Math.Abs(param.value);
            else
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "请输入正确的数值！", null);
            if (param.value == 0)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "请输入正确的数值！", null);
            //积分来源【汇总表】查询汇总表详细信息
            var totalScoreInfo1 = operateContext.bllSession.T_VRScoreSourceMain.FindSingle(o => o.userid == param.userid && o.itemType == param.type && o.proType == param.proType);
            if (totalScoreInfo1 == null)
            {
                //汇总数据为空时添加积分汇总数据
                totalScoreInfo1 = new T_VRScoreSourceMain
                {
                    userid = param.userid,
                    user_id = userInfo.user_id,
                    user_name = userInfo.user_name,
                    itemType = param.type,
                    proType = param.proType,
                    inScore = 0,
                    outScore = 0,
                    totalScore = 0,
                    createDate = DateTime.Now,
                    updateDate = DateTime.Now,
                    logCode = Helper.GetGuid
                };
                operateContext.bllSession.T_VRScoreSourceMain.Add(totalScoreInfo1);
            }
            T_VRScoreSourceDetail ssd = new T_VRScoreSourceDetail();
            ssd.userid = param.userid;
            ssd.user_id = userInfo.user_id;
            ssd.user_name = userInfo.user_name;
            ssd.itemType = param.type;
            //获取积分
            if (param.value > 0)
            {
                ssd.inScore = value;
                ssd.outScore = 0;
                ssd.totalScore = totalScoreInfo1.totalScore + value;
            }
            else if (param.value < 0)
            {
                ssd.inScore = 0;
                ssd.outScore = value;
                ssd.totalScore = totalScoreInfo1.totalScore - value;
                if (ssd.totalScore < 0)
                {
                    return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, "用户积分不足", null);
                }
            }
            ssd.proType = param.proType;
            ssd.createDate = DateTime.Now;
            ssd.logCode = Guid.NewGuid().ToString().Replace("-", "");
            //积分来源明细【详情表】添加记录
            operateContext.bllSession.T_VRScoreSourceDetail.Add(ssd);
            //更新积分汇总表收入 或支出，余额
            if (param.value > 0)
                operateContext.bllSession.T_VRScoreSourceMain.Modify(new T_VRScoreSourceMain { totalScore = totalScoreInfo1.totalScore + ssd.inScore, inScore = totalScoreInfo1.inScore + ssd.inScore,updateDate=DateTime.Now }, o => o.logCode.Equals(totalScoreInfo1.logCode), "totalScore", "inScore", "updateDate");
            else if (param.value < 0)
                operateContext.bllSession.T_VRScoreSourceMain.Modify(new T_VRScoreSourceMain { totalScore = totalScoreInfo1.totalScore - ssd.outScore, outScore = totalScoreInfo1.outScore - ssd.outScore, updateDate = DateTime.Now }, o => o.logCode.Equals(totalScoreInfo1.logCode), "totalScore", "outScore", "updateDate");
            return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, "保存成功", null);
        }
        #endregion

        #region 6.5 ✔兑换积分 + RedeemPoints(InputRedeemPoints param)
        /// <summary>
        /// 6.5 ✔兑换积分
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        [ModelValid]
        public WebApiResultJsonModel<int?> RedeemPoints(InputRedeemPoints param)
        {
            //1.0、参数验证
            var userInfo = operateContext.bllSession.T_User.FindSingle(o => o.user_guid == param.userid);
            if (userInfo == null)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "用户编码数据异常！", null);
            //2.0、分数余额
            var pointInfo = operateContext.bllSession.T_VRScoreSourceMain.FindSingle(o => o.userid.Equals(param.userid) && o.itemType.Equals(param.type));
            if (pointInfo == null || pointInfo.totalScore<=0)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "该用户无分数记录或积分分数为零！", null);
            //分数余额
            //decimal point = pointInfo.totalScore;
            //2.1、判读积分兑换规则是否存在
            var itemid = operateContext.bllSession.T_ItemCode.FindSingle(o => o.item_code.Equals("PointsRule"));
            if (itemid == null)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "请设置兑换规则", null);
            var codeInfo = operateContext.bllSession.T_ItemCodeMenum.FindSingle(o => o.item_id == itemid.item_id && o.code_value == param.type);
            if (codeInfo == null || string.IsNullOrEmpty(codeInfo.code_type) || string.IsNullOrEmpty(codeInfo.numValue))
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "请设置兑换规则、数量值等必要参数！", null);
            //字典项条件值
            int whereValue = Helper.ToInt(codeInfo.code_type);
            //字典项数量值
            int numValue = Helper.ToInt(codeInfo.numValue);
            //兑换积分
            int points = (int)(pointInfo.totalScore / whereValue) * numValue;
            if (points <= 0)
                return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Exception, "暂无兑换积分！", null);
            //添加分数来源明细
            //消耗分数
            int outScore = points / numValue * whereValue,
                //剩余分数
                totalScore = Helper.ToInt(pointInfo.totalScore) - outScore;
            //添加积分来源明细
            int mark= operateContext.bllSession.T_VRScoreSourceDetail.Add(new T_VRScoreSourceDetail
            {
                userid = param.userid,
                user_id = userInfo.user_id,
                user_name = userInfo.user_name,
                itemType = param.type,
                inScore = 0,
                outScore = outScore,
                totalScore = totalScore,
                proType = param.proType,
                createDate = DateTime.Now,
                scoreNote = "兑换积分",
                logCode = Helper.GetGuid
            });           
            if (mark > 0)
            {
                //更新分数来源汇总
                operateContext.bllSession.T_VRScoreSourceMain.Modify(new T_VRScoreSourceMain { outScore = pointInfo.outScore + outScore, totalScore = pointInfo.totalScore - outScore, updateDate = DateTime.Now }, o => o.logCode.Equals(pointInfo.logCode), "outScore", "totalScore", "updateDate");
            }           
            //查询用户积分汇总 积分余额
            var tsmInfo = operateContext.bllSession.T_VRTotalScoreMain.FindSingle(o => o.userid.Equals(param.userid)  && o.proType.Equals(param.proType));
            int inGold = points,//收入积分
                totalGold = points;//余额
            if(null!= tsmInfo)
            {
                inGold += Helper.ToInt(tsmInfo.inGold);
                totalGold += Helper.ToInt(tsmInfo.totalGold);
            }
            //添加积分明细
            mark = operateContext.bllSession.T_VRTotalScoreDetail.Add(new T_VRTotalScoreDetail
            {
                logCode = Helper.GetGuid,
                userid = param.userid,
                user_id = userInfo.user_id,
                user_name = userInfo.user_name,
                itemType = param.type,
                inGold = points,
                outGold = 0,
                totalGold = points,
                proType = param.proType,
                createDate = DateTime.Now,
                scoreNote = "兑换积分"
            });
            if (mark > 0)
            {
                //更新积分汇总
                if (tsmInfo != null)
                    operateContext.bllSession.T_VRTotalScoreMain.Modify(new T_VRTotalScoreMain { inGold = inGold, totalGold = totalGold }, s => s.logCode.Equals(tsmInfo.logCode), "inGold", "totalGold");
                else
                    operateContext.bllSession.T_VRTotalScoreMain.Add(new T_VRTotalScoreMain
                    {
                        logCode = Helper.GetGuid,
                        userid = param.userid,
                        user_id = userInfo.user_id,
                        user_name = userInfo.user_name,
                        inGold = inGold,
                        outGold = 0,
                        totalGold = totalGold,
                        proType = param.proType
                    });
            }
            return ApiResultJsonModel<int?>.RedirectWebApi(WebResultCode.Ok, "兑换成功", totalGold);
        }
        #endregion

        #region 获取用户积分明细
        /// <summary>
        /// 获取用户积分明细
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        [HttpPost]
        [ModelValid]
        public WebApiResultJsonModel<List<OutputGetUserPointsList>> GetUserPointsList(InputGetUserPointsList param)
        {

            var userInfo = SysPermissSession.ChangeIdByGuid(param.userid);
            if (userInfo <= 0)
            {
                return ApiResultJsonModel<List<OutputGetUserPointsList>>.RedirectWebApi(WebResultCode.Exception, "用户编码数据异常！", null);
            }
            if (!IsDate(param.StartDate))
            {
                return ApiResultJsonModel<List<OutputGetUserPointsList>>.RedirectWebApi(WebResultCode.Exception, "请输入正确的开始日期！", null);
            }
            if (!IsDate(param.EndDate))
            {
                return ApiResultJsonModel<List<OutputGetUserPointsList>>.RedirectWebApi(WebResultCode.Exception, "请输入正确的结束日期！", null);
            }
            var list = operateContext.bllSession.T_VRTotalScoreDetail.GetUserPointsList(param);
            return ApiResultJsonModel<List<OutputGetUserPointsList>>.RedirectWebApi(WebResultCode.Ok, "", null);
        }
        #endregion

        /// <summary>
        /// 判断字符串是否是日期
        /// </summary>
        /// <param name="strDate"></param>
        /// <returns></returns>
        public bool IsDate(string strDate)
        {
            try
            {
                DateTime.Parse(strDate); //不是字符串时会出现异常
                return true;
            }
            catch
            {
                return false;
            }
        }
    }
}